package com.yiqi.lottery.feature.documentary.model;

import com.suozhang.framework.component.http.RxDataProcessFactory;
import com.suozhang.framework.entity.bo.PageData;
import com.suozhang.framework.entity.bo.UserInfoBo;
import com.yiqi.lottery.entity.bo.HallBo;
import com.yiqi.lottery.entity.bo.HallUserBo;
import com.yiqi.lottery.entity.bo.OrderBo;
import com.yiqi.lottery.entity.bo.OrderDetailBo;
import com.yiqi.lottery.feature.documentary.contract.DocumentaryContract;
import com.yiqi.lottery.feature.documentary.contract.PersonContract;
import com.yiqi.lottery.feature.documentary.dependencies.hall.DaggerDocumentaryModelComponent;
import com.yiqi.lottery.feature.documentary.dependencies.home.DaggerFollowModelComponent;
import com.yiqi.lottery.framework.api.ApiLib;
import com.yiqi.lottery.framework.api.LotteryApi;
import io.reactivex.Observable;

import javax.inject.Inject;

public class PersonModel implements PersonContract.Model {

    @Inject
    LotteryApi api;

    @Inject
    public PersonModel() {

        DaggerFollowModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<String> followUser(UserInfoBo userId) {
        return api.followUser(userId).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> unfollowUser(UserInfoBo userId) {
        return api.unfollowUser(userId).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> followOrder(OrderBo orderId) {
        return api.followOrder(orderId).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<HallUserBo> getUserInfo(Integer userid) {
        return api.getHallUser(userid).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<OrderDetailBo> getGendanDetail(Integer orderid,int  type) {
        return api.getGendanDetail(orderid,type).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
